/*
 * This is the class for the main menu.
 * From this menu, we can access the list of
 * ingredients, recipes, and meals
 * In those sub-menus, we can access the
 * availability of each of those items
 */

package com.cs474.cupcakes7;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;
import android.os.Bundle;


public class Main extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main_menu);
        
        //Find the buttons so we can listen for clicks
        final Button buttonIngredient 	= (Button)findViewById(R.id.buttonIngredients);
        final Button buttonRecipes 		= (Button)findViewById(R.id.buttonRecipes);
        final Button buttonMeals		= (Button)findViewById(R.id.buttonMeals);
        
        //Add listener for ingredient button
        buttonIngredient.setOnClickListener(new View.OnClickListener() {
        	@Override
			public void onClick(View v) {
        		startActivity(new Intent(Main.this, IngredientsList.class));	
			}
		});
        //Add listener for recipes button
        buttonRecipes.setOnClickListener(new View.OnClickListener() {
        	@Override
			public void onClick(View v) {
        		startActivity(new Intent(Main.this, RecipesList.class));	
			}
		});
        //Add listener for meals button
        buttonMeals.setOnClickListener(new View.OnClickListener() {
        	@Override
			public void onClick(View v) {
        		startActivity(new Intent(Main.this, MealsList.class));				
			}
		});
        
        //A simple check to make sure that the cupcake.c file is working...
		//Toast t = Toast.makeText(this,stringFromJNI(), Toast.LENGTH_LONG);
    	//t.show();
		//string name, double amount, string unit, int type
    	//String success = newIngredient("Ingredient1", 30.0, "small", 0);
		//Toast t = Toast.makeText(this,success, Toast.LENGTH_LONG);
    	//t.show();
    	
    	//We need to initialize some stuff here        
    }
    

    
    
    /* All the java native interface methods go after this line */

    //public native String stringFromJNI();
    //jstring n, jdouble am, jint un, jint ty
    //public native String newIngredient(String string, double d, int un, int ty);

    //Load the c/c++ shared library we created 
    static {
        System.loadLibrary("cupcake");
    }
}
